package cn.tedu.spring.auto;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

@Repository
public class UserCache {
    /*
        1.Autowired注解，只能根据类型进行装配,不能根据IoC容器中Spring Bean对象名称进行装配;
        2.如果一个接口有多个实现类时,会抛出异常:NoUniqueBeanDefinitionException;
        3.解决:结合@Qualifier注解,根据Bean对象的名称进行装备配
     */
    @Qualifier(value = "cacheImpl1")
    @Autowired
    private Cache cache;

}
